<template>
  <div>
    <el-button type="primary" @click="dialogVisible = true">点击打开</el-button>

    <!-- 对话框组件 -->
    <el-dialog
      title="提示"
      :visible.sync="dialogVisible"
      width="30%"
      :before-close="handleClose"
    >
      <template #default>
        <el-form label-width="80px">
          <el-form-item label="用户名">
            <el-input
              placeholder="请输入用户名"
              prefix-icon="el-icon-user-solid"
              v-model="userForm.username"
            ></el-input>
          </el-form-item>
          <el-form-item label="密码">
            <el-input
              placeholder="请输入密码"
              prefix-icon="el-icon-lock"
              v-model="userForm.password"
              :show-password="true"
            ></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="submitForm('ruleForm')"
              >提交</el-button
            >
            <el-button @click="resetForm('ruleForm')">重置</el-button>      
          </el-form-item>
        </el-form>
      </template>

      <span slot="footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogVisible = false"
          >确 定</el-button
        >
      </span>
    </el-dialog>
    <router-view />
  </div>
</template>

<script>
export default {
  data() {
    return {
      userForm: {
        username: "",
        password: "",
      },
      dialogVisible: false,
    };
  },
  methods: {
    handleClose(done) {
      this.$confirm("确认关闭？")
        .then((_) => {
          done();
        })
        .catch((_) => {});
    },
  },
};
</script>

<style>
.el-input__inner {
  width: 60% !important;
}
</style>